<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户信息管理</title> <#include "/WEB-INF/content/module-index.html">
<script type="text/javascript">
$(function(){
	$("#search").click(function(){
		var username=$("#username").val();
		var mobile=$("#mobile").val();
		var qq=$("#qq").val();
		var wechat=$("#wechat").val();
		$("#grid").datagrid("reload",{"username":username,"mobile":mobile,"qq":qq,"wechat":wechat});		
	});
	
	$("#address").click(function(){
		var selectItemId = getSelectItemId();
		if (selectItemId){
			top.openModule("user_address","用户地址","user/address/index?uid="+selectItemId);
		}else{
			top.showMsg("请选择一行");
		}
	});
	
	$("#share").click(function(){
		var selectItemId = getSelectItemId();
		if (selectItemId){
			top.openModule("user_share","用户分享","user/share/index?sharemobile="+$("#grid").datagrid('getSelected').mobile);
		}else{
			top.showMsg("请选择一行");
		}
	});	
	
	$("#relation").click(function(){
		var selectItemId = getSelectItemId();
		if (selectItemId){
			top.openModule("user_relation","我的金矿","user/relation/index?uid="+selectItemId);
		}else{
			top.showMsg("请选择一行");
		}
	});
});
function sexFormatter(value,rowData,rowIndex){
	if(value){
		if(value=="1"){
			return "男";
		}else
			if(value=="2"){
				return "女";
			}else{
				return "未设置";
			}
	}
}

function statusFormatter(value,rowData,rowIndex){
	if(value==0){
		return "正常";
	}else
		if(value==2){
			return "未激活";
		}else
			return "禁用";
}
</script>
<style>
a.btn-border{
	border: 1px solid #ccc;
}
</style>
</head>
<body>
<body class="easyui-layout">
	<div region="center" style="padding: 5px; background:#eee;">
		<div id="toolbar">
			<input name="username" id="username" placeholder="用户名"/>
			<input name="mobile" id="mobile" placeholder="请输入手机号码"/>
			<input name="qq" id="qq" placeholder="请输入qq"/>
			<input name="wechat" id="wechat" placeholder="请输入微信号"/>
			<a id="search" class="easyui-linkbutton" icon="icon-search" style="border: 1px solid #ccc" plain="true">搜索</a>
			
			<@auth code="user:address:index">
				<a id="address" class="easyui-linkbutton" icon="icon-search" style="border: 1px solid #ccc" plain="true">TA的收货地址</a>
			</@auth>
			<@auth code="user:share:index">
				<a id="share" class="easyui-linkbutton" icon="icon-search" style="border: 1px solid #ccc" plain="true">TA的分享</a>
			</@auth>
			<@auth code="user:relation:index">
				<a id="relation" class="easyui-linkbutton" icon="icon-search" style="border: 1px solid #ccc" plain="true">我的金矿</a>
			</@auth>			
		</div>
		<table id="grid" class="easyui-datagrid" url="query" align="center" idField="uid" rownumbers="true" striped="true" fitColumns="true" fit="true" pagination="true" singleSelect="true" toolbar="#toolbar">
			<thead>
				<tr>
					<th field="username" width="50">用户名</th>
					<th field="mobile" width="50">手机号码</th>
					<th field="sex" width="50" formatter="sexFormatter">性别</th>
					<th field="birthday" width="50">出生日期</th>
					<th field="qq" width="50">qq</th>
					<th field="wechat" width="50">微信号</th>
					<th field="daole" width="50">道乐数量</th>
					<th field="status" width="20" formatter="statusFormatter">状态</th>
					<th field="createtime" width="30" align='center'>创建时间</th>
				</tr>
			</thead>
		</table>
	</div>
</body>
</body>

</html>